<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>RESULT</title>
  <link rel="shortcut icon" href="./img/logo.ico" type="image/x-icon">
  <link rel="stylesheet" href="./result.css">
</head>
<body>
<h2 align="center">result</h2>
<div id="container" class="resultBox">
  <script>
    // 获取存储在本地的数据
    var data = JSON.parse(localStorage.getItem('data'));
    // data = data.replace(/\n/g,'<br>').replace()
    var str = '';
    // 对数据进行遍历，拼接到页面显示
    for(var i=0;i<data.length;i++){
      str += '<div class="item">'+
              '<div class="resultText">'+ (i+1)+'. '+ data[i]+'</div>'+
              '</div>';
    }
    // 放入页面的容器显示
    document.getElementById('container').innerHTML = str;

    // 清除本地存储的数据
    localStorage.removeItem('data');
  </script>
</div>
</body>
</html>